<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>VUE Template</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
    <script type="text/javascript">
        let data = {
            name:'南大',
            address:'南京'
        }
        const obs = new Observer(data);
        
        let vm = {};
        vm._data = data = obs;

        function Observer(obj){
            const keys = Object.keys(obj);
            keys.forEach((k)=>{
                Object.defineProperty(this,k,{
                    get(){
                        return obj[k];
                    },
                    set(val){
                        console.log(`${k}被更改，解析模板，生成虚拟DOM`);
                        obj[k] = val;
                    }
                });
            });
        }

    </script>
</body>
 
</html>